<?php
//if (isset($_SESSION['username'])) {
include_once 'header.php';
require_once("conn.php");
require_once("change_page.php");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title>乐知家园</title>        
        <style type="text/css">
            <!--
            body,td,th {
                font-family: 微软雅黑;
                font-size: 14px;
                color: #000000;
            }

            .STYLE1 {color: #FFFFFF}
            -->
        </style></head>
    <body>
        <br/>
        <table width="80%" border="0" align="center" cellpadding="1" cellspacing="1" bgcolor="#FFFFFF">
            <tr align="align">
                <td bgcolor="#FFFFFF"></td>
                <td><a href="checkQuestionVoice.php">检查语音文件</a></td>
                <td><a href="questionVoice.php?menu=question">语音</a>、<a href="questionPic.php?menu=question">图片</a></td>
                <td bgcolor="#FFFFFF" align="right"><?php
$page_size = 100;
if (isset($_GET['page'])) {
    $page = $_GET['page'];
} else {
    $page = 0;
}

$sql = "SELECT COUNT(*) AS total FROM t_game_answer WHERE type = 'voice'";
$db = new DBC();
$total_num = $db->fetchData($sql);
if ($total_num != null) {
    $total_num_product = $total_num[0]['total'];
}
$page_count = getPageSize($total_num_product, $page_size);
echo getPage("questionVoice.php?menu=question", $page_count, $page);
?></td>
            </tr>
        </table>
        <br/>
        <table width="80%" border="0" align="center" cellpadding="1" cellspacing="1" bgcolor="#9999FF">
            <tr align="center">                
                <td bgcolor="#666666"><span class="STYLE1">序号</span></td>
                <td bgcolor="#666666"><span class="STYLE1">文件名</span></td>
                <td bgcolor="#666666"><span class="STYLE1">序号</span></td>
                <td bgcolor="#666666"><span class="STYLE1">文件名</span></td>
                <td bgcolor="#666666"><span class="STYLE1">序号</span></td>
                <td bgcolor="#666666"><span class="STYLE1">文件名</span></td>
                <td bgcolor="#666666"><span class="STYLE1">序号</span></td>
                <td bgcolor="#666666"><span class="STYLE1">文件名</span></td>
                <td bgcolor="#666666"><span class="STYLE1">序号</span></td>
                <td bgcolor="#666666"><span class="STYLE1">文件名</span></td>
            </tr>
            <?php
            $begin = $page * $page_size;
            $sql = "SELECT * FROM t_game_answer WHERE type = 'voice' ORDER BY code LIMIT " . $begin . "," . $page_size;
            $num = $begin;
            $data = $db->fetchData($sql);
            $i = 0;
            foreach ($data as $product) {
                if ($i == 0) {
                    ?>
                    <tr>      <?php } ?>              
                    <td bgcolor="#FFFFFF">&nbsp;<?php echo++$num; ?></td>
                    <td bgcolor="#FFFFFF">&nbsp;<?php echo $product['code']; ?></td>
                    <?php $i++;
                    if ($i % 5 == 0) {
                        ?></tr><tr><?php } ?>
            <?php } ?></tr>
        </table>
    </body>
</html>
<?php
include_once 'footer.php';
//} else {
//    header("login.php");
//}
?>